1. Initializing

First let us initialize cloudmesh and print the version number.


In [1]:
import cloudmesh

In [2]:
print cloudmesh.__version__


0.5

1.1 Reading the configuration file

Next let us read the configuration file, that includes the parameters to connect to various clouds and to interact with them. By default the load() method will look for a file in

Note: error, how do we refer to python code in markdown. file is located at config.filename

that contains the necessary information to connect to a variety of clouds. If you specify a filename as parameter such as

  • cloudmesh.load(filename="my.yaml")

it will be reading for the specified yaml file instead.


In [4]:
config = cloudmesh.load()

You can print the location of the configuration file with


In [6]:
print config.filename


/Users/neu/.cloudmesh/cloudmesh.yaml

The yaml file contains the definitions that enable you to connect to various clouds. We have predefined a number of clouds that we deploy as part of FutureGrid. There is an example in the cloudmesh code under

  • ~/.cloudmesh/etc/cloudmesh.yaml

that you can look at and modify for your purpose. Naturally this will work also with other clouds and you can define your own. just make sure that the name of the cloud does not contain a "-".


In [12]:
print config.get("cloudmesh.clouds").keys()


['india_openstack_essex', 'india-eucalyptus', 'sierra_openstack_grizzly']

In [15]:
print config.clouds().keys()


['india_openstack_essex', 'india-eucalyptus', 'sierra_openstack_grizzly']

In [24]:
for name in config.clouds():
    cloud = config.cloud(name)
    print name, "=", cloud["cm_type"]


india_openstack_essex = openstack
india-eucalyptus = eucalyptus
sierra_openstack_grizzly = openstack

In [25]:
for name in config.active():
    cloud = config.cloud(name)
    print name, "=", cloud["cm_type"]


sierra_openstack_grizzly = openstack

1.2 Activating a Cloud


In [26]:
config.activate("india_openstack_essex")


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-26-5d0f6f0a4e79> in <module>()
----> 1 config.activate("india_openstack_essex")

AttributeError: 'cm_config' object has no attribute 'activate'

In [27]:
config.deactivate("india_openstack_essex")


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-27-584851e52823> in <module>()
----> 1 config.deactivate("india_openstack_essex")

AttributeError: 'cm_config' object has no attribute 'deactivate'

In [28]:
config.validate("sierra_openstack_grizzly")


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-28-b562e8e46204> in <module>()
----> 1 config.validate("sierra_openstack_grizzly")

AttributeError: 'cm_config' object has no attribute 'validate'

In [ ]: